import cv2
import numpy as np
import matplotlib.pyplot as plt

img = cv2.imread("./img/cat.png")
gray_img = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
h,w,d = img.shape

x = np.arange(w)
y = np.zeros(x.shape)

for i in range(h):
    for j in range(w):
        if gray_img[i][j] / 255 < 1:
            y[j] = y[j] + gray_img[i][j] / 255

plt.plot(x,y,'r-')
plt.show()